package top.lyjwn.todo.webSocket;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import jakarta.websocket.HandshakeResponse;
import jakarta.websocket.server.HandshakeRequest;
import jakarta.websocket.server.ServerEndpointConfig;

//配置类  将http中的session传入websocket中

public class GetRequestInfoConfigurator extends ServerEndpointConfig.Configurator {

    private final Logger log = LoggerFactory.getLogger("info");

    @Override
    public void modifyHandshake(ServerEndpointConfig config, HandshakeRequest request, HandshakeResponse response) {
        if (request.getHeaders()!=null){
            config.getUserProperties().put("headers", request.getHeaders());
        }
    }
}
